package com.timebank.score.service.impl;

import com.timebank.common.security.utils.SecurityUtils;
import com.timebank.score.mapper.LotteryLogMapper;
import com.timebank.score.pojo.entity.LotteryLog;
import com.timebank.score.pojo.vo.LotteryLogVO;
import com.timebank.score.service.LotteryLogService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 抽奖记录 实现类
 * @author shiliuyinzhen
 */
@Service
public class LotteryLogServiceImpl implements LotteryLogService {

    @Resource
    private LotteryLogMapper lotteryLogMapper;

    /**
     * 新增抽奖记录
     *
     * @param lotteryLog
     */
    @Override
    public int addLotteryLog(LotteryLog lotteryLog) {
        return lotteryLogMapper.addLotteryLog(lotteryLog);
    }

    /***
     * 查询抽奖记录
     * @param lotteryLog
     * @return
     */
    @Override
    public List<LotteryLogVO> getLotteryLogList(LotteryLog lotteryLog) {
        lotteryLog.setUserId(SecurityUtils.getUserId());
        return lotteryLogMapper.getLotteryLogList(lotteryLog);
    }
}
